# 具体迭代器类
from iterators.iterator import Iterator


class ConcreteIterator(Iterator):
    def __init__(self, collection):
        self.collection = collection
        self.index = 0

    def has_next(self):
        return self.index < len(self.collection)

    def next(self):
        if self.has_next():
            value = self.collection[self.index]
            self.index += 1
            return value
        else:
            raise StopIteration